package com.ruoyi.system.domain;

import java.time.LocalDateTime;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 【请填写功能名称】对象 request_log
 * 
 * @author ruoyi
 * @date 2025-02-05
 */
@ApiModel(value = "RequestLog", description = "请求日志")
public class RequestLog
{
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty("主键")
    private Long id;

    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    @ApiModelProperty("url")
    private String url;

    /** 请求方式 */
    @Excel(name = "请求方式")
    @ApiModelProperty("请求方式")
    private String method;

    /** 请求体 */
    @Excel(name = "请求体")
    @ApiModelProperty("请求体")
    private String body;

    /** 请求头 */
    @Excel(name = "请求头")
    @ApiModelProperty("请求头")
    private String query;

    /** 请求开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty("请求开始时间")
    @Excel(name = "请求开始时间", width = 30, dateFormat = "yyyy-MM-dd")
    private LocalDateTime timestampStart;

    /** 请求结束时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty("请求结束时间")
    @Excel(name = "请求结束时间", width = 30, dateFormat = "yyyy-MM-dd")
    private LocalDateTime timestampEnd;

    /** 状态 */
    @Excel(name = "状态")
    @ApiModelProperty("状态")
    private Integer status;

    /** 异常 */
    @Excel(name = "异常")
    @ApiModelProperty("异常")
    private String exception;

    /** ip */
    @Excel(name = "ip")
    @ApiModelProperty("ip")
    private String ip;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setUrl(String url) 
    {
        this.url = url;
    }

    public String getUrl() 
    {
        return url;
    }
    public void setMethod(String method) 
    {
        this.method = method;
    }

    public String getMethod() 
    {
        return method;
    }
    public void setBody(String body) 
    {
        this.body = body;
    }

    public String getBody() 
    {
        return body;
    }
    public void setQuery(String query) 
    {
        this.query = query;
    }

    public String getQuery() 
    {
        return query;
    }
    public void setTimestampStart(LocalDateTime timestampStart)
    {
        this.timestampStart = timestampStart;
    }

    public LocalDateTime getTimestampStart()
    {
        return timestampStart;
    }
    public void setTimestampEnd(LocalDateTime timestampEnd)
    {
        this.timestampEnd = timestampEnd;
    }

    public LocalDateTime getTimestampEnd()
    {
        return timestampEnd;
    }
    public void setStatus(Integer status)
    {
        this.status = status;
    }

    public Integer getStatus()
    {
        return status;
    }
    public void setException(String exception) 
    {
        this.exception = exception;
    }

    public String getException() 
    {
        return exception;
    }
    public void setIp(String ip) 
    {
        this.ip = ip;
    }

    public String getIp() 
    {
        return ip;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("url", getUrl())
            .append("method", getMethod())
            .append("body", getBody())
            .append("query", getQuery())
            .append("timestampStart", getTimestampStart())
            .append("timestampEnd", getTimestampEnd())
            .append("status", getStatus())
            .append("exception", getException())
            .append("ip", getIp())
            .toString();
    }
    public RequestLog(String ip, String url, String method, String body, String query, LocalDateTime timestampStart) {
        this.ip=ip;
        this.url = url;
        this.method = method;
        this.body = body;
        this.query = query;
        this.timestampStart = timestampStart;
    }

    public RequestLog(String url, String method, String body, String query, LocalDateTime timestampStart, LocalDateTime timestampEnd, Integer status, String exception) {
        this.url = url;
        this.method = method;
        this.body = body;
        this.query = query;
        this.timestampStart = timestampStart;
        this.timestampEnd = timestampEnd;
        this.status = status;
        this.exception = exception;
    }

    public RequestLog(){}
}
